<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";

%>

<div id="page-content">
    <div class="row">

        <div class="col-lg-12">
            <div class="panel">
                <div class="panel-heading">
                    <h3 class="panel-title">公告通知测试</h3>
                </div>
                <div class="panel-body">
                    <div class="form-inline">
                        <div class="row">
                            <div class="col-sm-12 table-toolbar-left">
                                <btn id="btn_add_noticeTest" class="btn btn-primary btn-sm" ${isCreate}>
                                    <i class="ti-plus"> </i> 新建公告通知测试
                                </btn>
                            </div>
                        </div>
                    </div>
                    <div class="table-jqgrid">
                        <table id="noticeTest_table"></table>
                        <div id="noticeTest_page"></div>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>

<script>

    $(function(){

        init_grid_noticeTest();

    });

    function init_grid_noticeTest() {

        __init_jqgrid('noticeTest_table', 'noticeTest_page',
                '<%=path%>/com/noticeTest/list?viewtype=${viewtype}',
                ['日期',"公告类型",'通知主题',"创建人","文档状态","操作","id"],
                [
                    {name:'createTime',index:'createTime', width:100,search:true,sortable:true, searchoptions: {sopt: ['cn']}},
                    {name:'type',index:'type', width:200,sortable:true,search:true, searchoptions: {sopt: ['cn']}},
                    {name:'topic',index:'topic', width:250,search:true,sortable:true, searchoptions: {sopt: ['cn']}},
                    {name:'creater',index:'creater',sortable:true,search:true,width:80, searchoptions: {sopt: ['cn']}},
                    {name:'state',index:'state', search:true,sortable:true,width:80, searchoptions: {sopt: ['cn']}},
                    {name:'act',index:'act', width:210,sortable:false,search:false,fixed:true,formatter: actFormat},
                    {name:'id',index:'id',search:false,hidden:true}
                ],
                true,true
        );

    }




    function actFormat(cellvalue, options, rowObject){
        var id = rowObject.id;
        cellvalue = '<button class="btn btn-white btn-sm" onclick="fn_noticeTest_read(\'' + id + '\');"><i class="fa fa-eye"> </i> 查看</button>';

        return cellvalue;
    }

    function fn_noticeTest_read(id) {
        loadURL('<%=path%>/com/noticeTest/read?keyId='+id+'&viewtype=${viewtype}', $('#page-content'));
    }




    $("#btn_add_noticeTest").click(function(){
        loadURL('<%=path%>/com/noticeTest/input', $('#page-content'));
    });
</script>